/**
 * <p>Title: ServiceZMCMG2.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张坤 二级库存信息
 * @version 1.0
 * <pre>History:
 *          2010-12-17 下午01:33:45  张坤  Create
 *</pre>
 */
package com.baosight.sczx.zm.cm.service;

import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.basetools.TablePk;
import com.baosight.sczx.common.zm.cInterface.cs.InitialData;
import com.baosight.sczx.zm.cm.domain.ZMCM2levelmaterialbase;


/**二级库存信息
 * <p>Title: ServiceZMCMG2.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张坤
 * @version 1.0
 * <pre>History:
 *          2010-12-17 下午01:33:45  张坤  Create
 *</pre>
 */
public class ServiceZMCMG2 extends ServiceEPBase {
	/**
	 * 页面初始化方法
	 * <p>Function: initLoad</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCMG2</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2010-12-17 下午01:35:45  张坤  Create
	 * </p>
	 *
	 */
	@Override
	public EiInfo initLoad(EiInfo inInfo) 
	{
		EiInfo outInfo;
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		outInfo = this.query(inInfo);
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.units"));
		return outInfo;
	}
	
	/**
	 * 查询方法
	 * 根据查询条件查询从表数据信息
	 * <p>Function: query</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCMG2</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2010-12-17 下午01:36:45  张坤  Create
	 * </p>
	 *
	 */
	@Override
	public EiInfo query(EiInfo inInfo) 
	{
		String fdDepotCode = inInfo.getString("fdDepotCode");
		StaticTools.setQueryParameters(inInfo, "fdDepotCode", fdDepotCode, true);//添加查询条件 库房编号
		EiInfo outInfo = super.query(inInfo, "ZMCM2levelmaterialbase.query", new ZMCM2levelmaterialbase());
		return outInfo;
	}
	
	/**
	 * 新增方法
	 * 新增从表数据
	 * <p>Function: insert</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCMG2</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2010-12-17 下午01:38:45  张坤  Create
	 * </p>
	 *
	 */
	@Override
	public EiInfo insert(EiInfo inInfo) 
	{
			inInfo.getBlock("result").setCell(0, "fdKeyId", TablePk.getInstance().getNextValue("T_CM_2LEVELMATERIALBASE"));//主键
			EiInfo outInfo = super.insert(inInfo, "ZMCM2levelmaterialbase.insert", "result");
			return outInfo;
	}
	
	/**
	 * 明细customview 取一级库房物资信息
	 * <p>Function: queryforCustomview</p>
	 * <p>Description: </p>
	 * <p>return value:EiInfo</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-21 上午09:30:43 张坤
	 * </p>
	 *
	 */
	public EiInfo materialcode(EiInfo inInfo) {
		EiInfo outInfo = super.query(inInfo, "ZMCMMaterialBase.queryMaterialcode",new ZMCM2levelmaterialbase());
		return outInfo;

	}
	/**
	 * 明细customview 取二级库房物资信息
	 * <p>Function: queryforCustomview</p>
	 * <p>Description: </p>
	 * <p>return value:EiInfo</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-21 上午09:30:43 张坤
	 * </p>
	 *
	 */
	public EiInfo materialcode2(EiInfo inInfo) {
		EiInfo outInfo = super.query(inInfo, "ZMCM2levelmaterialbase.queryMaterialcode2",new ZMCM2levelmaterialbase());
		return outInfo;
	}
}
